#if !defined(__DAEMON_SUB_PROCESS)
#define __DAEMON_SUB_PROCESS

#include <sys/types.h>
#define  MAX_FAILED_COUNT 3

typedef struct {
    char *cmd; // 子进程的命令 app  ota  update
    pid_t pid; // 子进程的pid
    int  failed_count; // 子进程失败的次数
} sub_process_t;

/**
 * @brief 初始化子进程
 */
sub_process_t *daemon_sub_process_init(char *cmd);

/**
 * @brief 检查or启动子进程
 */
int  daemon_sub_process_check_and_start(sub_process_t *sub_process);

/**
 * @brief 销毁子进程
 */
void daemon_sub_process_destroy(sub_process_t *sub_process);



#endif // __DAEMON_SUB_PROCESS
